from .base import Object, Set

class Style(Object):
    """ public interface Style
    Remarks
    =======
    The Style object includes style attributes (font, font style, paragraph
    spacing, and so on) as properties of the Style object. The Style object is
    a member of the Styles collection. The Styles collection includes all the
    styles in the specified document.

    Use Styles(index), where index is the style name, a WdBuiltinStyle constant or
    index number, to return a single Style object. You must exactly match the
    spelling and spacing of the style name, but not necessarily its capitalization.

    The style index number represents the position of the style in the
    alphabetically sorted list of style names.

    To apply a style to a range, paragraph, or multiple paragraphs, set the
    Style property to a user-defined or built-in style name.

    Use the OrganizerCopy(String, String, String, WdOrganizerObject) method to copy styles between documents and templates. Use the UpdateStyles() method to update the styles in the active document to match the style definitions in the attached template. Use the OpenAsDocument() method to open a template as a document so that you can modify the template styles.

    Properties
    ==========

    Application
    Returns a Application object that represents the Microsoft Word application.

    AutomaticallyUpdate
    True if the style is automatically redefined based on the selection. False if Microsoft Word prompts for confirmation before redefining the style based on the selection. Read/write Boolean.

    BaseStyle
    Returns or sets an existing style on which you can base the formatting of another style. Read/write Object.

    Borders
    Returns a Borders collection that represents all the borders for the specified object.

    BuiltIn
    True if the specified object is one of the built-in styles or caption labels in Microsoft Word. Read-only Boolean.

    Creator
    Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Integer.

    Description
    Returns the description of the specified style. Read-only String.

    Font
    Returns or sets a Font object that represents the character formatting of the specified object. Read/write Font.

    Frame
    Returns a Frame object that represents the frame formatting for the specified style. Read-only.

    Hidden
    Reserved for internal use.

    InUse
    True if the specified style is a built-in style that has been modified or applied in the document or a new style that has been created in the document. Read-only Boolean.

    LanguageID
    Returns or sets the language for the specified object. Read/write.

    LanguageIDFarEast
    Returns or sets an East Asian language for the specified object.

    Linked
    Returns or sets a Boolean that represents whether a style is a linked style that can be used for both paragraph and character formatting. Read-only.

    LinkStyle
    Sets or returns an Object that represents a link between a paragraph and a character style. Read/write.

    ListLevelNumber
    Returns the list level for the specified style. Read-only Integer.

    ListTemplate
    Returns a ListTemplate object that represents the list formatting for the specified Style object.

    Locked
    True if the specified style is locked.

    NameLocal
    Returns the name of a built-in style in the language of the user. Read/write String.

    NextParagraphStyle
    Returns or sets the style to be applied automatically to a new paragraph inserted after a paragraph formatted with the specified style. Read/write Object.

    NoProofing
    True if the spelling and grammar checker ignores text formatted with this style. Read/write Integer.

    NoSpaceBetweenParagraphsOfSameStyle
    True for Microsoft Word to remove spacing between paragraphs that are formatted using the same style. Read/write Boolean.

    ParagraphFormat
    Returns or sets a ParagraphFormat object that represents the paragraph settings for the specified style. Read/write.

    Parent
    Returns an object that represents the parent object of the specified object.

    Priority
    Returns or sets a Integer that represents the priority for sorting styles in the Styles task pane. Read/write.

    QuickStyle
    Returns or sets a Boolean that represents whether the style corresponds to an available quick style. Read/write.

    Shading
    Returns a Shading object that refers to the shading formatting for the specified object.

    Table
    Returns a TableStyle object representing properties that can be applied to a table using a table style.

    Type
    Returns the style type. Read-only Style.

    UnhideWhenUsed
    Set True to clear the Hidden property when this style is used.

    Visibility
    Reserved for internal use.

    Methods
    =======
    Delete()
    Deletes the specified object.

    LinkToListTemplate(ListTemplate, Object)
    Links the specified style to a list template so that the style's formatting can be applied to lists.
    """
    @property
    def Application(self):
        """ Returns a Application object that represents the Microsoft Word application. """
        from .word import Application
        return Application(self.Instance.Application)

    @property
    def AutomaticallyUpdate(self):
        """ True if the style is automatically redefined based on the selection.
        False if Microsoft Word prompts for confirmation before redefining the
        style based on the selection. Read/write Boolean. """
        return self.Instance.AutomaticallyUpdate

    @property
    def BaseStyle(self) -> 'Style':
        """ Returns or sets an existing style on which you can base the formatting of another style. Read/write Object. """
        return Style(self.Instance.BaseStyle)

    @property
    def Borders(self):
        """ Returns a Borders collection that represents all the borders for the specified object."""
        return self.Instance.Borders


    @property
    def BuiltIn(self) -> bool:
        """ True if the specified object is one of the built-in styles or caption labels in Microsoft Word. Read-only Boolean."""
        return self.Instance.BuiltIn

    @property
    def Creator(self) -> int:
        """ Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Integer.  """
        return self.Instance.Creator

    @property
    def Description(self) -> str:
        """ Returns the description of the specified style. Read-only String. """
        return self.Instance.Description

    @property
    def Font(self):
        """ Returns or sets a Font object that represents the character
        formatting of the specified object. Read/write Font. """
        return self.Instance.Font

    @property
    def Frame(self):
        """ Returns a Frame object that represents the frame formatting for the specified style. Read-only."""
        return self.Instance.Frame

    @property
    def Hidden(self) -> bool:
        """ Reserved for internal use."""
        return self.Instance.Hidden

    @property
    def InUse(self) -> bool:
        """ True if the specified style is a built-in style that has been modified or applied in the document or a new style that has been created in the document. Read-only Boolean."""
        return self.Instance.InUse

    @property
    def LanguageID(self) -> int:
        """ Returns or sets the language for the specified object. Read/write."""
        return self.Instance.LanguageID

    @property
    def LanguageIDFarEast(self):
        """ Returns or sets an East Asian language for the specified object."""
        return self.Instance.LanguageIDFarEast

    @property
    def Linked(self) -> bool:
        """ Returns or sets a Boolean that represents whether a style is a linked style that can be used for both paragraph and character formatting. Read-only."""
        return self.Instance.Linked

    @property
    def LinkStyle(self):
        """ Sets or returns an Object that represents a link between a paragraph and a character style. Read/write."""
        return self.Instance.LinkStyle

    @property
    def ListLevelNumber(self) -> int:
        """ Returns the list level for the specified style. Read-only Integer."""
        return self.Instance.ListLevelNumber

    @property
    def ListTemplate(self) -> Object:
        """ Returns a ListTemplate object that represents the list formatting for the specified Style object."""
        return self.Instance.ListTemplate

    @property
    def Locked(self) -> bool:
        """ True if the specified style is locked."""
        return self.Instance.Locked

    @property
    def NameLocal(self) -> str:
        """ Returns the name of a built-in style in the language of the user. Read/write String."""
        return self.Instance.NameLocal

    @property
    def NextParagraphStyle(self) -> 'Style':
        """ Returns or sets the style to be applied automatically to a new paragraph inserted after a paragraph formatted with the specified style. Read/write Object."""
        return Style(self.Instance.NextParagraphStyle)

    @property
    def NoProofing(self) -> bool:
        """ True if the spelling and grammar checker ignores text formatted with this style. Read/write Integer."""
        return self.Instance.NoProofing

    @property
    def NoSpaceBetweenParagraphsOfSameStyle(self) -> bool:
        """ True for Microsoft Word to remove spacing between paragraphs that are formatted using the same style. Read/write Boolean."""
        return self.Instance.NoSpaceBetweenParagraphsOfSameStyle

    @property
    def ParagraphFormat(self) -> 'ParagraphFormat':
        """ Returns or sets a ParagraphFormat object that represents the paragraph settings for the specified style. Read/write."""
        from .paragraph import ParagraphFormat
        return ParagraphFormat(self.Instance.ParagraphFormat)

    @property
    def Parent(self) -> Object:
        """ Returns an object that represents the parent object of the specified object."""
        return Object(self.Instance.Parent)

    @property
    def Priority(self) -> int:
        """ Returns or sets a Integer that represents the priority for sorting styles in the Styles task pane. Read/write."""
        return self.Instance.Priority

    @property
    def QuickStyle(self) -> bool:
        """ Returns or sets a Boolean that represents whether the style corresponds to an available quick style. Read/write."""
        return self.Instance.QuickStyle

    @property
    def Shading(self):
        """ Returns a Shading object that refers to the shading formatting for the specified object."""
        return self.Instance.Shading

    @property
    def Table(self) -> 'TableStyle':
        """ Returns a TableStyle object representing properties that can be applied to a table using a table style."""
        return TableStyle(self.Instance.Table)

    @property
    def Type(self) -> type:
        """ Returns the style type. Read-only Style."""
        return self.Instance.Type

    @property
    def UnhideWhenUsed(self) -> bool:
        """ Set True to clear the Hidden property when this style is used."""
        return self.Instance.UnhideWhenUsed

    @property
    def Visibility(self) -> bool:
        """ Reserved for internal use."""
        return self.Instance.Visibility

    def saveobj(self):
        return {
            'Class': 'Style',
            'Name': self.NameLocal
        }

    def __repr__(self):
        return f'{{NameLocal={self.NameLocal}}}'

class TableStyle(Style):
    pass

class Styles(Set):
    def __init__(self, instance):
        super().__init__(instance, Style)

